echo "Compiling HIMTOS..." &&
echo "    --> start.asm" &&
yasm -felf32 -mx86 -o start.o kernel/start.asm &&
echo "    --> kernel/runtime/object.d" &&
ldc -nodefaultlib -m32 -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/object.d -of kernel.runtime.object.o &&
echo "    --> kernel/runtime/invariant.d" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/invariant.d -of kernel.runtime.invariant.o &&
echo "    --> kernel/runtime/std/typeinfo/*" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c `ls kernel/runtime/std/typeinfo/*.d` -od . &&
echo "    --> kernel/runtime/dstubs.d" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/dstubs.d -of kernel.runtime.dstubs.o &&
echo "    --> kernel/runtime/util.d" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/util.d -of kernel.runtime.util.o &&
echo "    --> kernel/runtime/precision.d" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/precision.d -of kernel.runtime.precision.o &&
echo "    --> kernel/runtime/std/moduleinit.d" &&
ldc -nodefaultlib -m32 -g -I. -I./kernel/runtime/. -code-model=kernel -c kernel/runtime/std/moduleinit.d -of kernel.runtime.std.moduleinit.o &&
echo "    --> console.d" &&
ldc -nodefaultlib -m32 -g -I./kernel/runtime/ -I. -c kernel/dev/console.d -of console.o &&
echo "    --> kprintf.d" &&
ldc -nodefaultlib -m32 -g -I./kernel/runtime/ -I. -c kernel/core/kprintf.d -of kprintf.o &&
echo "    --> util.d" &&
ldc -nodefaultlib -m32 -g -I./kernel/runtime -I. -c kernel/core/util.d -of util.o &&
echo "    --> manager.d" &&
ldc -nodefaultlib -m32 -g -I./kernel/runtime -I. -c kernel/mem/manager.d -of manager.o &&
echo "    --> gdt.d" &&
ldc -nodefaultlib -m32 -g -I./kernel/runtime -I. -c kernel/arch/x86/gdt.d -of gdt.o &&
echo "    --> kernel.d" &&
ldc  -nodefaultlib -m32 -g -I./kernel/dev/. -c kernel/core/kmain.d -of kernel.o &&
echo "    --> Linking himtos" &&
ld -nostedlib -nodefaultlibs -melf_i386 -belf32-i386 -T kernel/linker.ld -o himtos `ls *.o` &&
echo "Cleaining up..." &&
rm *.o &&
echo "Creating ISO image..." &&
mv himtos iso/boot/himtos &&
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 16 -boot-info-table -input-charset UTF-8 -o himtos.iso ./iso &&
echo "Done." &&
echo "Your HIMTOS ISO image is now ready for use!"
